UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rf+zerU/akiIBEoeVGpyfa1FKfQO6Q5tmuA6lV4gbh0=' 
WHERE 
  key_id = '165ae739db1f27731180fead2862de0791a142d7d09b63802fcb4c78c12ef05c' 
  AND (
    token = 'rf+zerU/akiIBEoeVGpyfa1FKfQO6Q5tmuA6lV4gbh0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016