UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EtRMXFafjWQI88+FkaORQP4no74rXsRcWgruTkGw60w=' 
WHERE 
  key_id = '50a4dc7155b1533b17476693f641adedb038bde84395367bdc52da095f43182d' 
  AND (
    token = 'EtRMXFafjWQI88+FkaORQP4no74rXsRcWgruTkGw60w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00080