UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WPupaw1wOHl+Q5xbhO58VLehv826zNBd8xn2xmzzVKI=' 
WHERE 
  key_id = '0154921f7064e032c64ae2d3a5f893de91d5f90d45025be7c7a6439f609faee2' 
  AND (
    token = 'WPupaw1wOHl+Q5xbhO58VLehv826zNBd8xn2xmzzVKI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026