UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KRHBxNo0peFJaPUVI7EVIDl6GFLFJ360mVnR9N3b15M=' 
WHERE 
  key_id = 'de84e984170c66119a5fb9d2d576ebefd6995d0da9d1688a094e89f95ab88409' 
  AND (
    token = 'KRHBxNo0peFJaPUVI7EVIDl6GFLFJ360mVnR9N3b15M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026