UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H8/Ie/9W1eboFx/TOPVKuUvEsbjZ+VGAXZgs0AdGyvA=' 
WHERE 
  key_id = '4cf14b82b5f35fdb15d62770519df1747455c2072f599e5e6519d242097e432d' 
  AND (
    token = 'H8/Ie/9W1eboFx/TOPVKuUvEsbjZ+VGAXZgs0AdGyvA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00065