UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cAv8QvXMuXctgj+NdbE1avg0VseldNjDTvfcpX4ITbc=' 
WHERE 
  key_id = 'af3143f6577e7a3521d52d88f358240e76445c97f73cb757167df6365cf520d7' 
  AND (
    token = 'cAv8QvXMuXctgj+NdbE1avg0VseldNjDTvfcpX4ITbc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047