UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0dvpETHXlYNEJBW+jck1r0jb2bRrwKKoO3ZtLDcbYcs=' 
WHERE 
  key_id = '350d910315ff70e7d7b126d443fda60d6125402595c79ce1b64b61a2f34a857f' 
  AND (
    token = '0dvpETHXlYNEJBW+jck1r0jb2bRrwKKoO3ZtLDcbYcs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043