UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iBkIZgAY/6pvHufH7+8wJHdTHe2Nl28cW/WoeYpwhDE=' 
WHERE 
  key_id = 'd87d5c1193537c3d1a36c9a0c778df029d44bfb764239edc0aa452bdaf62785b' 
  AND (
    token = 'iBkIZgAY/6pvHufH7+8wJHdTHe2Nl28cW/WoeYpwhDE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026