UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b4AckTTyJAP7f8+TCOSRsw60tCvSMBlp/J6HUens//s=' 
WHERE 
  key_id = 'ff0a966fe6d99cba1d9a3bdc6b84cb72915ad102c372ed329ac766b2c55ab587' 
  AND (
    token = 'b4AckTTyJAP7f8+TCOSRsw60tCvSMBlp/J6HUens//s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022