UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K2zu14T3KbIJb3Sftp1NPQUpZsRLw0CgQ7VkjvLE/6g=' 
WHERE 
  key_id = 'ffbbf00a38da2f920f86d16d4d51e36c5560a52521a505cd9fd153aee3106766' 
  AND (
    token = 'K2zu14T3KbIJb3Sftp1NPQUpZsRLw0CgQ7VkjvLE/6g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041