UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sjqYQ/8fBW6Dd+qTgiyYAA1WN9a3JupIGlZaYqfsBAU=' 
WHERE 
  key_id = '5d0ed61fa5bdb78880095a5dfcead41513a85203252540ac356865414cd4876a' 
  AND (
    token = 'sjqYQ/8fBW6Dd+qTgiyYAA1WN9a3JupIGlZaYqfsBAU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024