UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MQfoHP8SbqVK7d4MtFi9Pa5c5xIVStsw39upfa6+tKg=' 
WHERE 
  key_id = '897b026bfab61c1ac094070e2d98875ae4459928fd6adc315a77d0363cec3ecc' 
  AND (
    token = 'MQfoHP8SbqVK7d4MtFi9Pa5c5xIVStsw39upfa6+tKg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034