UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9g79a9FtCb+v+tyKt9PE54zfKeMcxGs/hjglWPy1yY4=' 
WHERE 
  key_id = 'a20bc72603a682c6ef9e842d22e2e128e430b15c1b26e6f8d129829dccf5f815' 
  AND (
    token = '9g79a9FtCb+v+tyKt9PE54zfKeMcxGs/hjglWPy1yY4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035