UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3MaQ07p4jMx5QByz7vXuKFpzhy0ZESlcEp+BFs0Oc0g=' 
WHERE 
  key_id = '00dbbe0b391d49117e347daafd99d15deb45473ffa899430d04289f7769f8d78' 
  AND (
    token = '3MaQ07p4jMx5QByz7vXuKFpzhy0ZESlcEp+BFs0Oc0g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042