UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mY3yYicEakCcEY+tI1F7vtaGVZcEj3ePnfup2o9yOdg=' 
WHERE 
  key_id = 'a1fcda0baf9c857c5d95a9558cbf2a9452cbe9e5585d47ac6d30590e020531ae' 
  AND (
    token = 'mY3yYicEakCcEY+tI1F7vtaGVZcEj3ePnfup2o9yOdg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047