UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e1i0QuK5qKhpP+UNI3thtqt8H3aj0gy9Zu7Ryd4gB/4=' 
WHERE 
  key_id = '322c90b7ba2418bcc36784511f6f9e52f7c70f65d80cc88b5564beb1e27aef8f' 
  AND (
    token = 'e1i0QuK5qKhpP+UNI3thtqt8H3aj0gy9Zu7Ryd4gB/4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037