UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iGmYq9Yyhtet6botxnMkrRKbS7qNZT057gzX58YeRd4=' 
WHERE 
  key_id = '6f795edf5e098cc7afab488f0def0f217bf30e49ae9a92030c214e8f0801c99e' 
  AND (
    token = 'iGmYq9Yyhtet6botxnMkrRKbS7qNZT057gzX58YeRd4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045