UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vDzwONrLOakXBexrH+cIcftVVBPHqEKTtZXBxm4MXo8=' 
WHERE 
  key_id = 'c3cbe7a967dd5b3e833d87a73cca6db89967e65547749e28006d556daf8a9d6c' 
  AND (
    token = 'vDzwONrLOakXBexrH+cIcftVVBPHqEKTtZXBxm4MXo8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024