UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fMau9kWmVDrLSd23ER+4QfyVdBdfCkLNdlUrk+ye3r0=' 
WHERE 
  key_id = 'bd16aa5aae854eef9be0931a12212f82743a1a0a194abb16470f99815df00952' 
  AND (
    token = 'fMau9kWmVDrLSd23ER+4QfyVdBdfCkLNdlUrk+ye3r0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00060