UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eJnn5504l9Ej2Ig3ZzOnkETYjJFZTe9aYHr2ZMAil8Q=' 
WHERE 
  key_id = '1d26bafba62c10a1ddf6cdcb47e2452027053ba926e46e03c004a631c9e85952' 
  AND (
    token = 'eJnn5504l9Ej2Ig3ZzOnkETYjJFZTe9aYHr2ZMAil8Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025