UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oD2s+IBqym85E13Q1FtjV5vbo+8S2tMYQ9mSpf3k/Ro=' 
WHERE 
  key_id = '82daefff696da939279ae64c6d741092bf90a4e185edaf7b493d10a8fcc02ad7' 
  AND (
    token = 'oD2s+IBqym85E13Q1FtjV5vbo+8S2tMYQ9mSpf3k/Ro=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042