UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pUh87po/u4xY5KRzXuDx+ZhxP9Uldi+9Q1eacy4V1O8=' 
WHERE 
  key_id = 'c5223599146914191fb6c18ed909fff96df599cb3648b3cb2f1a153af33f87a9' 
  AND (
    token = 'pUh87po/u4xY5KRzXuDx+ZhxP9Uldi+9Q1eacy4V1O8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026