UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O1sBrSTxqEf3clcjsio5lXMo/cOfs28EztXOdECRtFc=' 
WHERE 
  key_id = '55ccbb9b21856f0f8c06ad065253ba14fc1d6d3c60e5c05afd45af4387efd650' 
  AND (
    token = 'O1sBrSTxqEf3clcjsio5lXMo/cOfs28EztXOdECRtFc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040