UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dbd2DV47YRRZPHmQ6Zfcvv5VpcszvhPfnfbLc28wFGo=' 
WHERE 
  key_id = 'fc6234224285d441122a4ad976f6691c99e39d201a386a888fdfb3aea7561926' 
  AND (
    token = 'dbd2DV47YRRZPHmQ6Zfcvv5VpcszvhPfnfbLc28wFGo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039