UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DlZpAA8Ad6/2ZYNmCDL6fMMlh4/wT64MXL3+RLkJCTA=' 
WHERE 
  key_id = '0c4f9e8a57e145a5c2d439008994deb866bfd6954bed262035748efa588ec659' 
  AND (
    token = 'DlZpAA8Ad6/2ZYNmCDL6fMMlh4/wT64MXL3+RLkJCTA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037