UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9JPXhe+1hhWHJPl+c/2yS1nRS+K/AgsdO+JOwWcYTG4=' 
WHERE 
  key_id = 'fd848b6a32e8d025f7f1d17a08cdab0729b1844b43b62e3785c494179aa4acc1' 
  AND (
    token = '9JPXhe+1hhWHJPl+c/2yS1nRS+K/AgsdO+JOwWcYTG4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032