UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KU0a+OMqOkVdnOc4hEH3c+73I4bR+rjel+HZ3oEkFAU=' 
WHERE 
  key_id = '1a5f4cbaa92dcc21cb8d67f7dca1ed342bfe07c3bacd1faae0e7faaf75df316d' 
  AND (
    token = 'KU0a+OMqOkVdnOc4hEH3c+73I4bR+rjel+HZ3oEkFAU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029