UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sofpJMcEVAxQ1juxgw8lCEgVtTEGDJ3p1N3PhOAXYoM=' 
WHERE 
  key_id = 'be7dc8882ecb39bfb52857ac52553e087f87967e5d631a4819005278d34b6a1a' 
  AND (
    token = 'sofpJMcEVAxQ1juxgw8lCEgVtTEGDJ3p1N3PhOAXYoM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039