UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8fI8DWwou81tExWTeyfWdsB+xw7UfaccSNRd0j1mHIM=' 
WHERE 
  key_id = '0e56b2b15c3b5de6becb55549c283cb4c5ece18d0d729267ef7d0d83d4ccbe34' 
  AND (
    token = '8fI8DWwou81tExWTeyfWdsB+xw7UfaccSNRd0j1mHIM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034