UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lV0fCzjyeJAa0yaLoQ4we+S+zeFONXT3KcSMjPuQiZU=' 
WHERE 
  key_id = '54350597a02ed33b5d127daae231abe5565a42ba33c2cb060ceaff1ab59810e0' 
  AND (
    token = 'lV0fCzjyeJAa0yaLoQ4we+S+zeFONXT3KcSMjPuQiZU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028