UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x+TWKuniEpWuaypWdTFOSx79HE7ShrzK3q1IYIyJppA=' 
WHERE 
  key_id = '701cbd2605ec1c363ee52b358c2ed8e546d3508a6418090dc9b23eceb68b9d1c' 
  AND (
    token = 'x+TWKuniEpWuaypWdTFOSx79HE7ShrzK3q1IYIyJppA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00098