UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IuEs42abaKWk9MQNGCwxFTycqzmLYsmi6Cuq4bYZ5TU=' 
WHERE 
  key_id = '7204979f3a098c68b7e75e1004cdc1db7868109cad66d5b9e87e2991ca087012' 
  AND (
    token = 'IuEs42abaKWk9MQNGCwxFTycqzmLYsmi6Cuq4bYZ5TU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034