UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9qzHKHag05eGvFFdZh1lxJjLlRiEg9oZYdgn1lTudaU=' 
WHERE 
  key_id = 'b1a3805e1fdf2386cfe023a575374c67c73b138d8806c3d6760358f3cefa2caf' 
  AND (
    token = '9qzHKHag05eGvFFdZh1lxJjLlRiEg9oZYdgn1lTudaU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040