UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vVkFdMthUJj6Yoop1ZJyrWlzULkIFQAtiZgGDvRenQc=' 
WHERE 
  key_id = '564184076e46665b9764e365e38e930b5b33e9e3ea06a9b22cd573672c8a3748' 
  AND (
    token = 'vVkFdMthUJj6Yoop1ZJyrWlzULkIFQAtiZgGDvRenQc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046