UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'grxC/Phf9S5vKEHDtRGXrkmojGOMhwmlP6JQQprhvgw=' 
WHERE 
  key_id = '3774f307fcb3d705a7b9dabf83429171d1b8564827a848abe54e085b27ce0cdf' 
  AND (
    token = 'grxC/Phf9S5vKEHDtRGXrkmojGOMhwmlP6JQQprhvgw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034