UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y8nKRmz6ozjWQwyIdh0zzhyTPmf3cKtodlEbSuQP82o=' 
WHERE 
  key_id = '731705546d861a51119c5a2940b8c6212120bf8d86c4ed35eaca34f84ab3e0d9' 
  AND (
    token = 'y8nKRmz6ozjWQwyIdh0zzhyTPmf3cKtodlEbSuQP82o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030